package cn.com.my.yes1;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class X {

	public static void main(String[] args) {
		System.out.println("XXXXXXXXXXXXXXxx");
		
		String serialNumber = "JF" + format(new Date(), "yyyyMMddhhmmss") ;
		
		System.out.println(serialNumber);
		
		
		long total = 0;
		long total2 = 0;
		
		System.out.println(total==0 && total2==0);
		
		String dt1 = "2015-11-01";
		String dt2 = "2015-11-02";
		String dt3 = "2015-11-06";
		
	//	System.out.println(dt1 > dt2);
		
		System.out.println(compare_date(dt1, dt2));
	}

	public static String format(Date date, String pattern) {
		if(date == null) {
			return "";
		}
		if(pattern == null || "".equals(pattern)) {
			pattern = "yyyy-MM-dd";
		}
		SimpleDateFormat format = new SimpleDateFormat(pattern);
		return format.format(date);
	}
	
	public static int compare_date(String DATE1, String DATE2) {
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        try {
            Date dt1 = df.parse(DATE1);
            Date dt2 = df.parse(DATE2);
            if (dt1.getTime() > dt2.getTime()) {
                System.out.println("dt1在dt2后");
                return 1;
            } else if (dt1.getTime() < dt2.getTime()) {
                System.out.println("dt1在dt2前");
                return -1;
            } else {
                return 0;
            }
        } catch (Exception exception) {
            exception.printStackTrace();
        }
        return 0;
    }
	
}
